package be.gnx.fogo.application.util;

import java.util.Enumeration;
import java.util.Locale;
import java.util.ResourceBundle;

import be.gnx.fogo.application.dao.LabelDao;

public class LabelResourceBundle extends ResourceBundle {

  private LabelDao labelDao = new LabelDao();

  private Locale locale;

  public void setLocale(Locale locale) {
    this.locale = locale;
  }

  public Locale getLocale() {
    return locale;
  }

  @Override
  public Enumeration<String> getKeys() {
    return labelDao.getLabels();
  }

  @Override
  protected Object handleGetObject(String key) {
    return labelDao.handleGetObject(key, getLocale());
  }

}
